将同一产品下的部分设备进行分组后,方便用户对其统一管理,比如用户可以对某一组下的所有设备下发命令。
GET /api/v1/label
Query:
| Name | Type | Description | Required |
|---|---|---|---|
| currentPage | int | 页码 | Yes |
| pageSize | int | 每页条数(范围:1-50) | Yes |
| product | int | 产品ID | Yes |
| name | string | 名称(不传:全部),长度:0-128 | No |
cURL example:
curl --location --request GET '{URI-scheme}://{Endpoint}{path-prefix}/api/v1/label/remove/devices?accessKeyId={accessKeyId}&signature={signature}&signatureNonce=646¤tPage={currentPage}&pageSize={pageSize}&product={product}' \
--header 'platform: 3' \
--header 'projectId: {projectId}'
Response data:
| Name | Type | Description |
|---|---|---|
| currentPage | int | 页码 |
| pageSize | int | 每页条数(范围:1-50) |
| content | struct[] | 当前页内容 |
| totalCount | long | 总条数 |
| totalPage | int | 总页数 |
Response data content的子对象结构体:
| Name | Type | Description |
|---|---|---|
| created | long | 创建时间 |
| description | string | 描述 |
| deviceCount | long | 设备数量 |
| onlineDeviceCount | long | 在线设备数量 |
| enableDeviceCount | long | 启用设备数量 |
| id | int | 分组ID |
| name | string | 分组名称 |
| productId | int | 产品ID |
Response example:
{
"success": true,
"code": 0,
"msg": "",
"data": {
"content":[
{
"created": 0,
"description": "string",
"deviceCount": 0,
"enableDeviceCount": 0,
"id": 0,
"name": "string",
"onlineDeviceCount": 0,
"productId": 0
}
],
"currentPage": 0,
"pageSize": 0,
"totalCount": 0,
"totalPage": 0
}
}
POST /api/v1/label
Body:
| Name | Type | Description | Required |
|---|---|---|---|
| productId | int | 产品ID | Yes |
| name | string | 分组名称 | Yes |
| description | string | 描述 | No |
Body example:
{
"description": "string",
"name": "string123",
"productId": 100568
}
cURL example:
curl --location --request POST '{URI-scheme}://{Endpoint}{path-prefix}/api/v1/label?accessKeyId={accessKeyId}&signature={signature}&signatureNonce=646' \
--header 'platform: 3' \
--header 'projectId: {projectId}' \
--header 'Content-Type: application/json' \
--data-raw '{
"description": "string",
"name": "string123",
"productId": 100568
}'
Response data:
| Name | Type | Description |
|---|---|---|
| created | long | 创建时间 |
| description | string | 描述 |
| id | int | 分组ID |
| name | string | 分组名称 |
| productId | int | 产品ID |
Response example:
{
"success": true,
"code": 0,
"msg": null,
"data": {
"id": 174,
"productId": 100568,
"name": "string123",
"created": 1578474716405,
"description": "string"
}
}
PUT /api/v1/label
Body:
| Name | Type | Description | Required |
|---|---|---|---|
| id | int | 分组ID | Yes |
| name | string | 分组名称 | No |
| description | string | 描述 | No |
Body example:
{
"id":131,
"name":"string345",
"description":"string11"
}
cURL example:
curl --location --request PUT '{URI-scheme}://{Endpoint}{path-prefix}/api/v1/label?accessKeyId={accessKeyId}&signature={signature}&signatureNonce=646' \
--header 'platform: 3' \
--header 'projectId: {projectId}' \
--header 'Content-Type: application/json' \
--data-raw '{
"id":131,
"name":"string345",
"description":"string11"
}'
Response example:
{
"success": true,
"code": 0,
"msg": null,
"data": null
}
DELETE /api/v1/label
Body:
| Name | Type | Description | Required |
|---|---|---|---|
| ids | int[] | 分组ID数组 | Yes |
Body example:
{
"ids": [134]
}
cURL example:
curl --location --request DELETE '{URI-scheme}://{Endpoint}{path-prefix}/api/v1/label?accessKeyId={accessKeyId}&signature={signature}&signatureNonce=646' \
--header 'platform: 3' \
--header 'projectId: {projectId}' \
--header 'Content-Type: application/json' \
--data-raw '{
"ids": [134]
}'
Response example:
{
"success": true,
"code": 0,
"msg": null,
"data": null
}
GET /api/v1/label/id/{id}
Path:
| Name | Type | Description | Required |
|---|---|---|---|
| id | int | 分组ID | Yes |
cURL example:
curl --location --request GET '{URI-scheme}://{Endpoint}{path-prefix}/api/v1/label/id/{id}?accessKeyId={accessKeyId}&signature={signature}&signatureNonce=646' \
--header 'platform: 3' \
--header 'projectId: {projectId}'
Response data:
| Name | Type | Description |
|---|---|---|
| created | long | 创建时间 |
| description | string | 描述 |
| deviceCount | long | 设备数量 |
| onlineDeviceCount | long | 在线设备数量 |
| enableDeviceCount | long | 启用设备数量 |
| id | int | 分组ID |
| name | string | 分组名称 |
| productId | int | 产品ID |
Response example:
{
"success": true,
"code": 0,
"msg": "",
"data": {
"created": 0,
"description": "string",
"deviceCount": 0,
"enableDeviceCount": 0,
"id": 0,
"name": "string",
"onlineDeviceCount": 0,
"productId": 0
}
}
PUT /api/v1/label/add/devices
Body:
| Name | Type | Description | Required |
|---|---|---|---|
| deviceIds | int[] | 设备ID数组 | Yes |
| labelId | int | 分组ID | Yes |
Body example:
{
"deviceIds": [
10237731
],
"labelId": 128
}
cURL example:
curl --location --request PUT '{URI-scheme}://{Endpoint}{path-prefix}/api/v1/label/add/devices?accessKeyId={accessKeyId}&signature={signature}&signatureNonce=646' \
--header 'platform: 3' \
--header 'projectId: {projectId}' \
--header 'Content-Type: application/json' \
--data-raw '{
"deviceIds": [
10237731
],
"labelId": 128
}'
Response example:
{
"success": true,
"code": 0,
"msg": null,
"data": null
}
PUT /api/v1/label/remove/devices
Body:
| Name | Type | Description | Required |
|---|---|---|---|
| deviceIds | int[] | 设备ID数组 | Yes |
| labelId | int | 分组ID | Yes |
Body example:
{
"deviceIds": [10237732],
"labelId": 133
}
cURL example:
curl --location --request PUT '{URI-scheme}://{Endpoint}{path-prefix}/api/v1/label/remove/devices?accessKeyId={accessKeyId}&signature={signature}&signatureNonce=646' \
--header 'platform: 3' \
--header 'projectId: {projectId}' \
--header 'Content-Type: application/json' \
--data-raw '{
"deviceIds": [
10237732
],
"labelId": 133
}'
Response example:
{
"success": true,
"code": 0,
"msg": null,
"data": null
}
GET /api/v1/label/group/{relation}/page
Path:
| Name | Type | Description | Required |
|---|---|---|---|
| relation | string | 两种参数:IN/NIN | Yes |
Query:
| Name | Type | Description | Required |
|---|---|---|---|
| protocol | int | 产品协议 | No |
| currentPage | int | 页码 | Yes |
| pageSize | int | 每页条数(范围:1-50) | Yes |
| label | string | 分组ID(默认不传:全部, 长度:0-128) | Yes |
| deviceId | int | 设备ID | No |
| name | string | 设备名称(默认不传:全部, 长度:0-128) | No |
| adminState | int | 启用状态:0-全部,1-禁用,2-启用 | No |
| operatingState | int | 在线状态:0-全部,1-离线,2-在线 | No |
cURL example:
curl --location --request GET '{URI-scheme}://{Endpoint}{path-prefix}/api/v1/label/group/{relation}/page?accessKeyId={accessKeyId}&signature={signature}&signatureNonce=646¤tPage={currentPage}&pageSize={pageSize}&label={label}' \
--header 'platform: 3' \
--header 'projectId: {projectId}'
Response data:
| Name | Type | Description |
|---|---|---|
| currentPage | int | 页码 |
| pageSize | int | 每页条数(范围:1-50) |
| content | struct[] | 当前页内容 |
| totalCount | long | 总条数 |
| totalPage | int | 总页数 |
Response data content的子对象结构体:
| Name | Type | Description |
|---|---|---|
| created | long | 创建时间 |
| description | string | 描述 |
| adminState | int | 启用状态,0-禁用,1-启用,2-用户禁用 |
| apiKey | string | 设备key |
| connectGatewayId | string | 当前连接的网关 |
| encrypt | boolean | 是否加密,0:不加密,1:加密 |
| name | string | 设备名 |
| labels | string[] | 产品标签 |
| id | int | 设备ID |
| lastConnected | long | 最近上线时间 |
| lastReported | long | 最近上报状态的时间 |
| location | string | 位置 |
| modified | long | 修改时间 |
| operatingState | string | 上下线状态(0-disabled,1-enabled,2-gatewayenabled,3-未激活) |
| parentId | int | 关联网关ID |
| userId | string | 用户ID |
| protocolType | int | 协议类型,1:MQTT,2:LWM2M,3:TCP,4:Modbus,5:OPC UA |
| productId | int | 产品ID |
Response example:
{
"success": true,
"code": 0,
"msg": "",
"data":{
"content": [
{
"adminState": 0,
"apiKey": "string",
"connectGatewayId": "string",
"created": 0,
"description": "string",
"encrypt": true,
"id": 0,
"labels": [
"string"
],
"lastConnected": 0,
"lastReported": 0,
"location": "string",
"modified": 0,
"name": "string",
"operatingState": 0,
"parentId": 0,
"productId": 0,
"protocolType": 0,
"userId": "string"
}
],
"currentPage": 1,
"pageSize": 1,
"totalCount": 4,
"totalPage": 4
}
}